package com.example.text.ui.mall.model



import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.example.text.R


object ErrorEmptyUIUtils {
    const val ERROR_PAGE_SIZE = 1000000
    const val EMPTY_TIPS = "暂无数据内容"
    const val ERROR_TIPS = "网络开小差，请稍后重试"

//    const val EMPTY_ICON = R.mipmap.icon_examining_none
//    const val ERROR_ICON = R.mipmap.icon_api_failed

    fun updateEmptyUI(
        emptyView: View,
        pages: Int = 1,
        emptyTips: String = EMPTY_TIPS,
        errorTips: String = ERROR_TIPS,
        onRefresh: (() -> Unit)? = null
    ) {
//        if (pages == ERROR_PAGE_SIZE) {
//            emptyView.findViewById<View>(R.id.btnRetry).visibility = View.VISIBLE
//            emptyView.findViewById<View>(R.id.btnRetry).setOnClickListener {
//                onRefresh?.invoke()
//            }
//            emptyView.findViewById<TextView>(R.id.tv_errorView_hint).text = errorTips
//            emptyView.findViewById<ImageView>(R.id.ivEmptyOrError).setImageResource(ERROR_ICON)
//        } else {
//            emptyView.findViewById<View>(R.id.btnRetry).visibility = View.GONE
//            emptyView.findViewById<TextView>(R.id.tv_errorView_hint).text = emptyTips
//            emptyView.findViewById<ImageView>(R.id.ivEmptyOrError).setImageResource(EMPTY_ICON)
//        }
    }
}